---@class Battle.AiTriggerCondition:Battle.AiCondition
---@field New fun():Battle.AiTriggerCondition
local AiTriggerCondition = Battle.CreateClass("AiTriggerCondition",Battle.AiCondition)
Battle.AiTriggerCondition = AiTriggerCondition

function AiTriggerCondition:onInitialize()
    local key = self:GetParam(1)
    local value = self:GetParam(2)
    self:SetCondition(self:GetBlackboard():Get(key),value,Battle.CompareType.Equals)
    self:GetBlackboard():AddObserver(key,self.ValueOnChanged,self)
end
function AiTriggerCondition:ValueOnChanged(name,old,new)
    self:reset()
end

function AiTriggerCondition:ToString()
    local s = Battle.AiBehavior.ToString(self)
    return s.." condition:"..tostring(self:IsTrigger())
end